using System;
using TrainingWorkshop.MVPWebsite.Authority.Interface.Services;
using Microsoft.Practices.CompositeWeb;
using DataContracts;
using System.Collections.Generic;

namespace TrainingWorkshop.MVPWebsite.Authority
{
    public class AuthorityController : IAuthorityController
    {
        private IAuthorityService _authorityService;

        [ServiceDependency]
        public IAuthorityService AuthorityService
        {
            set { _authorityService = value; }
        }

        /// <summary>
        /// Save a New Authority
        /// </summary>
        /// <param name="authorityDTO"></param>
        /// <returns></returns>
        public bool AddNewAuthority(AuthorityDTO authorityDTO)
        {
            return _authorityService.AddNewAuthority(authorityDTO);
        }

        /// <summary>
        /// Delete Authority
        /// </summary>
        /// <param name="authorityId"></param>
        /// <returns></returns>
        public bool DeleteAuthority(int authorityId)
        {
            return _authorityService.DeleteAuthority(authorityId);
        }

        /// <summary>
        /// Update Authority
        /// </summary>
        /// <param name="authorityDTO"></param>
        /// <returns></returns>
        public bool UpdateAuthority(AuthorityDTO authorityDTO)
        {
            return _authorityService.UpdateAuthority(authorityDTO);
        }

        /// <summary>
        /// Get Authority by Current AuthorityId
        /// </summary>
        /// <param name="authorityId"></param>
        /// <returns></returns>
        public AuthorityDTO GetAuthorityById(int authorityId)
        {
            return _authorityService.GetAuthorityById(authorityId);
        }

        /// <summary>
        /// Get All Authority Level
        /// </summary>
        /// <returns></returns>
        public List<AuthorityLevelDTO> GetAllAuthorityLevel()
        {
            return _authorityService.GetAllAuthorityLevel();
        }

        /// <summary>
        /// Get All Authority
        /// </summary>
        /// <returns></returns>
        public List<AuthorityDTO> GetAllAuthority()
        {
            return _authorityService.GetAllAuthority();
        }

        /// <summary>
        /// Get Search Authority
        /// </summary>
        /// <param name="authorityName"></param>
        /// <param name="levelName"></param>
        /// <returns></returns>
        public List<AuthorityDTO> SearchAuthority(string authorityName, int levelId)
        {
            return _authorityService.SearchAuthority(authorityName, levelId);
        }

        //public AuthorityController()
        //{
        //}
    }
}
